package com.chenfan.mcn.component.dict;

import com.chenfan.common.extension.context.SpringContextHolder;
import com.chenfan.mcn.dao.StarBillingHeaderMapper;
import com.chenfan.common.extension.dict.DictTranslator;
import com.chenfan.mcn.model.StarBillingHeader;

/**
 * 红人开票抬头ID翻译成名称
 * @author wulg
 * @date 2021-12-11
 **/
public class StarBillingIdTranslator implements DictTranslator<Long, String> {

    @Override
    public String translate(Long starBillingId) {
        StarBillingHeaderMapper starBillingHeaderMapper = SpringContextHolder.getBean(StarBillingHeaderMapper.class);
        StarBillingHeader starBillingHeader = starBillingHeaderMapper.selectById(starBillingId);
        return starBillingHeader != null ? starBillingHeader.getHeaderName() : starBillingId.toString();
    }
}
